package com.jrx.anytxn.reporting.job.xib.step;

import com.jrx.anytxn.param.entity.PrOrganizationTable;
import com.jrx.anytxn.param.utils.BizTypeProducts;
import com.jrx.anytxn.transaction.entity.AmLoanMainInfo;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.batch.MyBatisPagingItemReader;

import java.util.HashMap;
import java.util.Map;

public class LoanReader extends MyBatisPagingItemReader<AmLoanMainInfo> {

    public LoanReader(SqlSessionFactory sqlSessionFactory , Integer pageSize , PrOrganizationTable org){
        setSaveState(false);
        setPageSize(pageSize);
        setSqlSessionFactory(sqlSessionFactory);
        setQueryId("com.jrx.anytxn.transaction.mapper.ext.ExtAmLoanMainInfoMapper.selectByPostingDateForBatchWithProducts");
        Map<String,Object> map = new HashMap<>();
        map.put("postingDate", org.getToday());
        map.put("productIds", BizTypeProducts.getXAHAndXAJSeriesProducts());
        setParameterValues(map);
    }
}
